package bonsai.dropwizard.dao;

import javax.persistence.*;

/**
 * Created by mohan.gupta on 11/04/17.
 */
@Entity
@Table(name = "configs")
@NamedQueries({
        @NamedQuery(name = "bonsai.dropwizard.dao.DBConfigEntry.findAll",
                query = "select e from DBConfigEntry e"),
        @NamedQuery(name = "bonsai.dropwizard.dao.DBConfigEntry.findByKey",
                query = "select e from DBConfigEntry e where key= :key")
})
public class DBConfigEntry {

    /**
     * Entity's unique identifier.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    /**
     * key.
     */
    @Column(name="`key`")
    private String key;

    @Column(name = "value")
    private String value;

    @Column(name = "type")
    private String type;

    @Column(name = "bucket")
    private String bucket;

    @Column(name = "notes")
    private String notes;

    /**
     * updated date
     */
    @Column(name = "updated_timestamp")
    private String lastModified;

    /**
     * A no-argument constructor.
     */
    public DBConfigEntry() {
    }
    /**
     * A constructor to create a row. Id is not passed, cause it's
     * auto-generated by RDBMS.
     *
     */
    public DBConfigEntry(String key, String value, String type) {
        this.key = key;
        this.value = value;
        this.type = type;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        this.bucket = bucket;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getLastModified() {
        return lastModified;
    }

    public void setLastModified(String lastModified) {
        this.lastModified = lastModified;
    }
}
